package main

type TreeNode struct {
	Val   int
	Left  *TreeNode
	Right *TreeNode
}

func isSymmetric(root *TreeNode) bool {
	return check(root, root)
}
func check(p *TreeNode, q *TreeNode) bool {
	if q == nil && p == nil {
		return true
	}
	if p == nil || q == nil {
		return false
	}
	return p.Val == q.Val && check(p.Right, q.Left) && check(p.Left, q.Right)
}
func main() {

}
